import org.w3c.dom.ls.LSOutput;

class Dog {
    public String name;//没有进行封装
    private int age;//使用了private进行了封装

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
public class Test2 {

    public static void main(String[] args) {
        Dog dog1 = new Dog();
        dog1.setAge(2);
        System.out.println(dog1.getAge());
    }
}
